import tkinter
from tkinter import Label
from PIL import Image, ImageTk, ImageEnhance, ImageFilter

win = tkinter.Tk()
win.title('增强图像')
win.geometry('400x200')  #定义窗体的大小400x200像素

photo = Image.open('dukou.jpg')
img1 = ImageTk.PhotoImage(photo) # 获取图片像素
label_1 = Label(win, image=img1)

def imgshow():
    #img = ImageEnhance.Contrast(photo)
    #img = img.enhance(1.8) #对比度增强为原来的1.5倍
    img = photo.filter(ImageFilter.EDGE_ENHANCE)
    img2 = ImageTk.PhotoImage(img) # 获取图片像素 
    label_2 = Label(win, image=img2).grid(row=1, column=1) 
    label_2.image = img2

button = tkinter.Button(win, text='增强图像处理',command=imgshow)

button.grid(row=0, column=0, columnspan=2)
label_1.grid(row=1, column=0) 

win.mainloop()